Skip to content

[BR-22555] Add the Hermes Agent plugin - #23

Open
0xDovah wants to merge 24 commits into
mainfrom
feat/hermes-plugin
Open

0xDovah wants to merge 24 commits into
mainfrom
feat/hermes-plugin

Conversation

@0xDovah

@0xDovah 0xDovah commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds Hermes Agent (Nous Research) as a supported host. plugin.json gets a com.nousresearch.hermes block: the bitrefill server is trust: untrusted, and buy-products costs 1 order against a spend_limit of 0.5, so Hermes asks before every order. The host guide is skills/bitrefill/references/harnesses/hermes.md; SKILL.md sends Hermes hosts there before the first Bitrefill call, and decision-engine.md and capability-matrix.md detect Hermes before OpenClaw. cli.md, mcp.md and safeguards.md get Hermes sections.

flowchart TD
  A["Install the plugin"] --> B["Ask Hermes to buy"]
  B --> C{"Bitrefill account connected?"}
  C -- yes --> M["Bitrefill connector:<br/>Hermes asks before each order"]
  C -- no --> Q{"Connect your account<br/>or continue as guest?"}
  Q -- "connect (sign in on the Hermes machine)" --> M
  Q -- guest --> W{"Agent's wallet"}
  W -- "none, or one that sends" --> G["Guest order:<br/>Bitrefill CLI via npx"]
  W -- "pays only x402 (AgentCash)" --> X["x402 checkout,<br/>paid by that wallet"]
  M --> P{"Who pays, after your yes"}
  G --> P
  P -- "your Bitrefill balance (connected account)" --> D["Code delivered in the chat"]
  P -- "the agent's wallet sends the exact amount" --> D
  P -- "you pay the link or address yourself" --> D
  X --> D
Loading
  • Signed in (connector): the agent quotes first, and only the user's reply to the quote confirms. Hermes then asks to approve the order. Only local sessions buy. Chat-app DMs only search and quote. Groups get "DM me to finish this". Cron jobs and other sources never buy. Every refusal gets one sentence: "The order wasn't approved, so nothing was bought."
  • Signed out: in a local chat the agent first asks, apart from the quote, whether to connect a Bitrefill account or continue as guest, also when the user already named a payment method; chat apps skip the ask. Guest checkout runs through npx -y @bitrefill/[email protected], with no global install. It places an order only after the user confirms product, amount, total, method and email. A crypto invoice is posted right away with amount, network, address and expiry in minutes, and checked only once the user says they paid.
  • Wallet that sends: a wallet the agent has pays the invoice after the user's yes, and only where checkout is allowed, by sending the exact amount to the invoice address. The wallet's own approvals and caps apply. The agent checks the wallet's request status and stops on a reject; it posts the address and doesn't retry.
  • Wallet that only pays x402 (AgentCash): connector and CLI orders have no x402 payment link, so the whole order runs on Bitrefill's x402 checkout through the wallet's own HTTP tool. It signs in once, searches, gets details and opens the invoice with the session token. After the user's yes it makes one invoice/pay, capped at the quoted price, then checks status until the code is delivered. A refused payment stops the order with no retry. Hermes doesn't ask before a wallet tool unless the owner prices it, so the confirm and the wallet's caps are the gates.

The README covers the Hermes install and its trade-offs:

  • the server is marked untrusted, and mcp add resets that;
  • the gateway should allow only the owner;
  • the invoice token stays in Hermes session history;
  • startup is about 10 s slower while signed out;
  • a wallet that pays without asking pays for whoever confirms in the chat;
  • an x402-only wallet signs in to Bitrefill with its own address.

Catalog submission and CI:

  • docs/hermes-catalog.md holds the plugin-catalog/bitrefill.yaml entry and the catalog PR text. The entry has requires_hermes: ">=0.22.3", the first release that reads costs and spend_limit. It also has a Disclosure — line in the house style and a known_issues line for the sign-in step. The PR text covers both checkout paths and every rule 13 disclosure.
  • A package server can't sign in by itself: it gets no auth: oauth (hermes-agent#115429), and hermes mcp login can't find it (hermes-agent#87253, in scope for hermes-agent#152002). So the mcp add + config set step stays until a Hermes release fixes both.
  • check.yml has a new hermes job. It runs Hermes's own plugin-validate action, with the action and the Hermes source pinned to the v0.23.4 commit.
  • release.yml now writes the review-doc link as a bare URL, so the scan no longer flags a Markdown link with an interpolated URL. What's left is 3 ssh_dir_access cautions from the deny rules in safeguards.md.
  • The README now also discloses that the server's instructions point to www.bitrefill.com/agents/SKILL.md when the skill isn't loaded, that tool results reach the model provider, and what submit_feedback sends. hermes.md sends feedback only when the user asks.

ClickUp: BR-22555

Test plan

Done on Hermes v0.23.3 (local bench, no funded wallet, no paid order):

  • Connect-or-guest ask on cf009de, live bench (clean home, signed out, test wallet named by the user): the agent asked the question on its own with no option recommended, then quoted separately after "guest"; nothing was ordered or sent.
  • Repo tests: 12/12 pass. Relative links are clean.
  • hermes plugins validate --install-deps on 7168c77: ok, trust untrusted, 1 costed tool, limit 0.5 orders.
  • Catalog install rehearsal: a local catalog entry pinned to 7168c77 installs exactly that SHA, enabled.
  • Guest flow, live, on the final text:
    • The agent reads the skill and hermes.md, makes one tool_search and uses only npx.
    • It quotes, waits for the yes, makes one buy-products (usdc_base, no link), then posts the address with "expires in 60 minutes".
    • There's no global CLI. The token isn't in the reply, memories/ or the working folder.
  • Against a mock connector (13 real tool schemas, buy-products never spends) in an interactive session:
    • Reads run with no prompt.
    • Deny: 0 buys, and the reply is "The order wasn't approved, so nothing was bought."
    • Allow once delivers the code.
    • /yolo still prompts.
    • An approval timeout: 0 buys, no retry.
    • Headless two-turn run: declined, no "spend limit" wording.
  • Approve one order, then deny a second in the same chat: 1 buy in total, and the reply doesn't blame a spend limit.
  • Against a mock wallet MCP that rejects the send: 1 order, 1 send of the exact amount, 1 status check, then a stop with the address posted and no retry. Re-run on 9f978b2 with the connector live: same result.
  • Against a mock AgentCash (fetch answers /x402/* from canned data and only records payments), on 9f978b2:
    • Signed out: connect, search, details and invoice all used the session token. The quote named 0.07 USDC, AgentCash and 15 minutes, with nothing paid. One invoice/pay came after the yes, maxAmount 0.07, then status; the code was delivered.
    • Connector signed in: the balance and a search went through the connector, but the order ran on x402. There was no buy-products.
    • The wallet refuses the payment as over its cap: "nothing was bought", no second pay or invoice, product link offered.
  • approvals.deny block, checked with hermes approvals test: 8 signed-in or self-reconfiguring commands are refused; guest search, guest crypto buy and whoami are allowed.
  • Spec grilled twice and the branch code-reviewed. Each Hermes claim was checked against the v0.23.3 source. Fixes are in 7168c77, 268af5e, 1020718 and 2777d1a; the x402 route is 9f978b2.
  • skill-audit scan: no new high or critical findings against main.
  • Live OAuth sign-in against api.bitrefill.com with a native mcp_servers.bitrefill entry (auth: oauth, trust: untrusted) and hermes mcp login bitrefill. Hermes signed in with its hosted client-metadata document and listed 13 tools. The live server's annotations put the 4 write tools behind the trust gate and let the 9 read-only tools run.
  • CI hermes job on 73cfae1: validation passed with trust untrusted, 1 costed tool, limit 0.5 orders and 3 cautions. It exits 1 on a broken plugin.json, checked locally.
  • The catalog entry in docs/hermes-catalog.md passes the hermes-agent scripts/validate_plugin_catalog.py from main, with a placeholder sha.

Live tests (signed-in account, real sats, Hermes Desktop and CLI):

  • Real paid order through the connector, signed in, in a Hermes Desktop local session:
    • The agent read the skill, searched, and fetched details and balances with no prompt. It quoted, re-quoted when the payment method changed, and waited for "yes".
    • buy-products raised Hermes's prompt. Allow once created a Lightning invoice. After "paid" there was one get-invoice-by-id call, and the code was delivered.
    • With the gateway restarted onto this branch (log: "using the native entry with the package's declared tool_costs, spend_limit, cost_unit"), a second order was Denied. 0 buys, no retry, and the reply was "wasn't approved, so nothing was bought or charged", with no spend-limit wording.
  • /yolo against the live server: the order still prompted. The denial logged as "denied 'buy-products' on spend-limited server", so the trust gate was off and the spend limit asked.
  • Headless run against the live server: hermes chat -q … --oneshot quoted and stopped. Resuming it with -q "yes" --oneshot made the agent call buy-products, which Hermes refused in 0.00s with no one to ask. The reply was "The order wasn't approved, so nothing was bought and no Lightning payment was made." Nothing was bought or paid. Side effect: Alby MCP marks no tools readOnlyHint, so trust: untrusted also prompts for (and headless refuses) its get_balance.
  • Live wallet payment (AC21) with Alby MCP over NWC (trust: untrusted, pay_invoice and fetch_l402 priced above spend_limit: 0.5):
    • Approve: the quote named the wallet. buy-products prompt → Allow once, then pay_invoice prompt → Allow once. The wallet paid 1,499 + 4 sats. Alby's pay_invoice then failed its own output schema ('amount', 'fee', 'fees' were unexpected, a bug in @getalby/mcp), so Hermes reported an error. The agent checked get-invoice-by-id once, found it paid and delivered the code. 09511b1 now makes that check the rule.
    • Reject: pay_invoice → Deny ("user denied 'pay_invoice' on untrusted server 'alby'"). The agent checked the invoice once, found it unpaid and stopped, with no retry and no wallet switch. It said "not approved", not "spend limit", and posted the Lightning invoice for manual payment. One deviation: it gave the expiry as a clock time computed with date in terminal, instead of the invoice's minutes.
  • Auth error: real OAuth tokens with the access and refresh tokens invalidated and the expiry in the past. hermes mcp test bitrefill fails with "The server rejected the sign-in. Run: hermes mcp login bitrefill". The tokens were restored afterwards, and the connector reconnected with 13 tools.
  • Guest card checkout with a billing address: npx -y @bitrefill/[email protected] buy-products … --billing_address '{…}' --payment_method fiat_card --json while whoami reports unregistered. It returned invoice_id, payment_link and expiration_minutes: 60. The invoice was left unpaid.
  • Validate and /yolo on Hermes v0.22.3 for the catalog floor: hermes plugins validate --install-deps passes with trust untrusted, 1 costed tool and limit 0.5 orders. I ran Hermes's _trust_gate_check with this policy and approval bypass on (/yolo / approvals.mode: off), with the prompt stubbed to decline:
    • On v0.22.3, buy-products and update-order prompt, and search-products runs.
    • On v0.23.4, buy-products still prompts because of the spend limit, but update-order runs without a prompt. hermes.md, the README and the catalog text now say the trust prompt for submit-prepayment-step, update-order and submit_feedback may be skipped under /yolo.
  • Version bump to v4.1.0 across every pin, docs/hermes-catalog.md included (cdefbc5). Tests, the packager (--tag v4.1.0) and claude plugin validate pass.

Not tested live, by decision:

  • An approval timeout against the live server: passed against the mock connector (0 buys, no retry). The live server only changes the tool behind the prompt, not Hermes's timeout path.
  • AgentCash order on x402 (AC22): no funded AgentCash wallet. Covered by the mock AgentCash run above (9f978b2).
  • Re-confirm when the price goes up (beb5645): it can't be triggered on demand. Covered by code review.
  • No-Node.js fallback: needs a machine where Hermes's terminal has no npx. Covered by code review; with no npx, the guide routes to the product link.

Still to do:

  • After merge: put the merge sha in docs/hermes-catalog.md's entry and open the catalog PR with its text.

Notes from live testing:

  • Alby's @getalby/mcp breaks its own output schema on pay_invoice ('amount', 'fee', 'fees' were unexpected) and marks no tool readOnlyHint, so under trust: untrusted Hermes prompts even for get_balance. Fixes are open upstream as getAlby/mcp #38 (strip undeclared fields) and #39 (tool annotations).
  • After a successful wallet payment, Hermes's own agent tried to save a lightning-invoice-payments skill with skill_manage (it failed validation). That is Hermes's skill learning, not this plugin.

0xDovah and others added 22 commits November 24, 2026 11:16
Hermes reads only a root plugin.json and mcp.json (Agent Plugins v1) and skips .claude-plugin, .cursor-plugin and .mcp.json, so the existing skills/ tree and connector need their own pair of manifests. mcp.json repeats the .mcp.json server as streamable-http: Hermes rejects type http and the placement key. plugin.json marks the server untrusted and prices buy-products at 1 order against a 0.5-order per-chat spend limit, so Hermes asks before every order, also under /yolo, and declines in cron. No version field, like .cursor-plugin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds harnesses/hermes.md and routing rows. Hermes is detected before OpenClaw, since Hermes hosts keep ~/.openclaw/ after an import. Connected profiles use the connector; others check out as a guest with the pinned CLI through terminal, only while whoami shows an unregistered identity. The CLI drops isError and exits 0 on failure, so the guide reads the result fields instead. Product, confirm and pay reuse grok-bot.md. Hermes-only rules: one buy-products call per confirm, never answer or steer the approval prompt, never execute_code, buy only in local sessions and DMs, never in cron or one-shot runs. AgentCash and awal settle x402 without asking, so Hermes leaves their host lists.

The cli.md guest example the route reads now sends package_value as a string (the live schema marks package_id deprecated) and --return_payment_link false, which returns the crypto address; the flag defaults to true.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
mcp.md gets the Hermes sign-in: OAuth through hermes mcp add, then trust set back to untrusted (mcp add resets it), recovery from a failed add, SSH paste-back with iss or a port-forward, and the Desktop link. Desktop refuses that link while the plugin is enabled, so the Desktop text runs the two commands first. It also drops stale lines the connected route reads: the key-in-path URL returns HTTP 410 (OpenClaw included), and signed-in accounts get 12 tools, not 7.

safeguards.md gets a Hermes section: each approval covers one order, disabling the plugin drops the limit, execute_code skips approvals.deny so the buying profile turns code_execution off, and deny globs block signed-in CLI buys, x402 payers and Hermes reconfiguring itself through terminal. It also drops the literal SSH directory from the Claude Code sandbox example so Hermes's install scan reads safe instead of caution. auto_pay is not in the buy-products schema and is removed where the Hermes route reads it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
README adds a Hermes section next to Cursor / Grok Bot with the three install and sign-in commands and the disclosures the Hermes catalog asks for (real money, the prompt and how to remove it, the shared profile, the guest CLI download). It installs bitrefill/agents until the catalog lists bitrefill. The OpenClaw line moves off the key-in-path URL, which returns HTTP 410. CLAUDE.md adds the two manifests to the tree, the Hermes validate and doctor checks, and the catalog entry step after each release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A clean Hermes v0.23.3 run with only the plugin installed the CLI
globally without asking, spent a tool_search before routing, and
created the guest invoice with no host prompt. Route straight to npx,
make the confirm the explicit gate for guest buy-products, allow guest
invoices in one-shot runs only with the confirm in that message, and
disclose the startup 401 and the token kept in session history.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Installing bitrefill/agents straight from GitHub is blocked by the
Hermes install-time scan (community source, caution verdict), so the
README names only the catalog entry. Drop a sentence the port left
under the Claude Code settings block, which already denies ~/.ssh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hermes ≥0.23 defers MCP tools behind tool_search, so a signed-in connector
is often absent from the tool list. Treat a deferred bitrefill server as
connected, allow one tool_search, drop the misleading 'outside the working
folder' wording (npx uses the npm cache) and keep the cli.md example
host-neutral.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A chat app's approval prompt reaches whoever is in the chat, and the skill
cannot tell the owner's DM from anyone else's. Chats quote from the account
and check out as a guest. Drops the one-shot rule the model cannot detect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hermes returns its spend-limit refusal on every declined order, so the skill
says plainly that nothing was bought. Chat-app DMs only search and quote from
the account, matched against an allowlist of chat platforms. Autonomous
buying lifts the prompt only in local sessions. A crypto invoice with no
address gets a payment-link checkout only after a new yes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Wallets are no longer excluded on Hermes. After the user's yes the skill opens
the invoice for a coin the wallet holds and pays it once from that wallet; the
wallet's own approvals and caps decide whether it asks again. AgentCash and
awal keep Hermes as a host, and the approvals.deny block no longer blocks x402
payers. README and safeguards disclose that a wallet that pays without asking
pays on whoever confirms in a chat app.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SKILL.md sends Hermes hosts to hermes.md before the first Bitrefill call,
and only a yes to the quote confirms an order: a mock run bought without
quoting when hermes.md was skipped. The crypto reply gives the expiry in
minutes, and hermes.md's payment rules take precedence over grok-bot.md's
no-address line. A wallet pays only where checkout is allowed, sends to the
invoice address or pays x402 when the invoice offers it, and is checked
until the user approves or rejects. Hermes is detected before OpenClaw in
every routing table. README and safeguards say the server is marked
untrusted and the gateway should allow only the owner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A live guest run polled get-invoice-by-id for four minutes before posting
the address. The crypto reply now goes out first and ends the turn; the
invoice is checked once the user says they paid or the wallet's payment
went through. whoami runs as its own call before a guest order, since
chaining it with && checks only the exit code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hermes words every refused order as a spent limit, so the skill never
repeats that. The prepayment and update-order prompts get their own line.
An uncertain outcome that list-invoices can't show is reported as possibly
unpaid. A Lightning invoice counts as the address, an invoice that expires
while a wallet request is open is not paid by hand, and hermes.md takes
precedence over the wallet pages. A signed-in CLI, other chat platforms,
cron runs and x402 REST checkout get the product link or a plain refusal;
the universal token-file and in-chat opt-in rules don't apply on Hermes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Slack gives every DM a thread, so a Slack DM may carry ", thread:". The
connect offer appears only in a local session, where signing in can lead to
an account purchase. A wallet without send says in the confirm that the
user may pay by hand, and never pays a payment link or a second order. The
wallet approval check is the wallet's own status tool. On Hermes the in-chat
autonomous opt-in works only in a local session, with Hermes still asking
unless the owner set trust: full. mcp.md warns that Desktop can't save other
MCP servers while both bitrefill entries exist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Connector and CLI orders carry no x402 payment link, so a wallet that pays
x402 but can't send (AgentCash) now runs the whole order on x402 checkout
through its own HTTP tool: connect once, search, details and invoice with
the session token, then one invoice/pay after the user's yes, capped at the
quoted price, and status until delivered. A refused or failed payment stops
the order; a 409 means it's paid; an expired quote needs a new yes. The
session token is kept like the invoice access token, and the wallet's order
list is read only in a local session. Wallets that can send keep paying
connector and CLI invoices by send. The README, routing pages and
safeguards say the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- check.yml: new `hermes` job runs Hermes's plugin-validate action, action and
  Hermes source pinned to the v0.23.4 commit.
- release.yml: bare URL in the release notes, so the Hermes security scan no
  longer flags a Markdown link with an interpolated URL.
- docs/hermes-catalog.md: the plugin-catalog/bitrefill.yaml entry
  (requires_hermes >=0.22.3 for costs and spend_limit, known_issues for the
  sign-in step, disclosure line) and the catalog PR description.
- README: disclose the server-side instructions, model-provider exposure and
  what submit_feedback sends.
- hermes.md: submit_feedback only when the user asks.
- CLAUDE.md: link the catalog doc and list it among the version pins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KSBQVHJmiLyi5H61WZ1NTe
- Version 4.1.0 in every manifest, the skill, README, CLAUDE.md,
  docs/openai-review.md and the catalog entry; release notes describe
  Hermes support.
- Under /yolo or approvals.mode: off, Hermes still asks before every
  buy-products call because of the spend limit, but its trust gate no
  longer asks before submit-prepayment-step, update-order or
  submit_feedback. hermes.md, the README and the catalog PR text now say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KSBQVHJmiLyi5H61WZ1NTe
… by hand

A wallet can pay and still return an error (Alby MCP's pay_invoice fails its
own output schema after paying). Posting the address then could make the user
pay an on-chain invoice twice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KSBQVHJmiLyi5H61WZ1NTe
@purrgrammer
purrgrammer marked this pull request as ready for review November 26, 2026 12:03
0xDovah and others added 2 commits November 26, 2026 14:57
…e quote

While the connector is signed out, a local Hermes chat now asks once, before the
quote and apart from the confirm, whether to connect a Bitrefill account or
continue as guest, also when the user already named a payment method. The README
shows the Hermes order flow as a Mermaid diagram, with who pays on each route.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
hermes.md held every rule in a few very long lines. It now has one
section per topic (where buying is allowed, routing, confirm, connector
orders, guest, crypto, wallets, x402, secrets) with the same rules.

Live tests on Hermes v0.23.4 found two confirm gaps:
- A payment method picked from a quote that showed only the card total
  was taken as the confirm, so the order ran without a Lightning total.
  A pick now confirms only when the quote showed that method's total.
- After a denied order, "try again" made the agent call buy-products
  with no new quote. A repeated request now needs a new quote and yes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@felipecamposfabel felipecamposfabel left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I tested this live on Hermes 0.23.4 and pushed a small change to hermes.md. I split it into sections so it's easier to follow (the rules are the same), and fixed two things I ran into:

  • Picking a payment method counted as the confirm, even when the quote only showed the card price. Now it only counts if that method's price was in the quote.
  • After I denied an order, "try again" went straight to buy-products without a new quote. Now it quotes again first.

Everything else worked well: guest flow, deny, /yolo, headless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants